﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BaseUnits;

namespace Carbon_Tracker
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                // TODO: This line of code loads data into the 'carbonTrackerDataSet.Texts' table. You can move, or remove it, as needed.
                this.textsTableAdapter.AppName(this.carbonTrackerDataSet.Texts);
            }
            catch (Exception ex)
            { }
            Splash.SplashScreen splash = Splash.SplashScreen.Current;
            splash.CloseSplashScreen();
            
        }

        private void databaseServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DatabaseInterface.ConfigureConnection conf = new DatabaseInterface.ConfigureConnection();
            conf.ShowDialog();
        }

        private void textsBindingSource_CurrentChanged(object sender, EventArgs e)
        {

        }
        

        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BaseUnits.Builders.GridBuilder gb = new BaseUnits.Builders.GridBuilder(new DatabaseInterface.Connection());
            IPowerGrid grid = gb.GetGrid(1000);
            //grid.SortedPowerUnits(2011, 70);
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DatabaseInterface.Connection cnx = new DatabaseInterface.Connection();
            frmPowerUnitManager frm = new frmPowerUnitManager(cnx);
            frm.Show();
        }

        private void PriorityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                frmPriority f = new frmPriority();
                f.MdiParent = this;
                this.Cursor = Cursors.WaitCursor;
                f.Show();
                
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            this.Cursor = Cursors.Default;
        }

        private void dispatchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDispatch f = new frmDispatch();
            f.MdiParent = this;
            f.Show();
            f.WindowState = FormWindowState.Maximized;
        }

        private void otraToolStripMenuItem_Click(object sender, EventArgs e)
        {
                
        }

        private void baseLineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmReporteOM f = new frmReporteOM();
            f.MdiParent = this;
            f.Show();
            f.WindowState = FormWindowState.Maximized;
        }

        private void listToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPowerUnitList f = new frmPowerUnitList();
            f.MdiParent = this;
            f.Show();
            f.WindowState = FormWindowState.Maximized;
        }

        private void modifyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmSearchPowerUnit f = new frmSearchPowerUnit();
            f.MdiParent = this;
            f.Show();
            //f.WindowState = FormWindowState.Maximized;
        }

        private void newToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            frmPowerPlantManager f = new frmPowerPlantManager();
            f.MdiParent = this;
            f.Show();
        }

        private void dispatchAuditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmReporteOM f = new frmReporteOM();
            f.AuditMode = true;
            f.MdiParent = this;
            f.Show();
            f.WindowState = FormWindowState.Maximized;
        }

        private void changeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmPowerPlantManager f = new frmPowerPlantManager();
            f.MdiParent = this;
            f.Show();
        }
    }
}
